import request from '@/utils/request';

/**
 * 获取角色列表
 * GET /promo-admin-api/permissionInfo/roleList
 */
export async function queryRoleList(data: API.RoleListParam, options?: API.baseOption) {
  return request<API.PageRoleList>('/role/list', {
    method: 'GET',
    data,
    ...(options || {}),
  });
}

/**
 * 新增/编辑角色
 * POST /promo-admin-api/role/saveOrUpdate
 */
export async function saveOrUpdate(data: API.RoleDetailParam, options?: API.baseOption) {
  return request<string>('/role/saveOrUpdate', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 获取角色信息
 * GET /promo-admin-api/role/getRoleDetail
 */
export async function queryRoleDetail(data: { id: string }, options?: API.baseOption) {
  return request<API.RoleDetail>('/role/getRoleDetail', {
    method: 'GET',
    data,
    ...(options || {}),
  });
}

/**
 * 删除角色信息
 * GET /promo-admin-api/role/delete
 */
export async function deleteRole(data: { id: string }, options?: API.baseOption) {
  return request<string>('/role/delete', {
    method: 'GET',
    data,
    ...(options || {}),
  });
}
